-
Notifications
You must be signed in to change notification settings - Fork 549
Runtime: Expose readonly directly off the datastore runtime #24410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Runtime: Expose readonly directly off the datastore runtime #24410
Conversation
…to ro/datastore-readonly
…to ro/datastore-readonly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR exposes the datastore runtime’s readonly flag and readonly event from the container runtime to reduce reliance on the delta manager. Key changes include adding a new feature constant (setReadonly) in the runtime definitions, propagating the readonly event in the FluidDataStoreRuntime, and updating tests and compatibility checks accordingly.
Reviewed Changes
Copilot reviewed 27 out of 29 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
packages/runtime/runtime-definitions/src/runtimeLayerCompatFeatureNames.ts | Added a new constant (setReadonly) to expose readonly functionality. |
packages/runtime/runtime-definitions/src/index.ts | Updated exports to include the new setReadonly feature. |
packages/runtime/runtime-definitions/src/dataStoreContext.ts | Added optional setReadOnlyState method and readonly flag to context interfaces. |
packages/runtime/datastore/src/dataStoreRuntime.ts | Implemented a getter for readonly and setReadOnlyState to propagate updates. |
packages/runtime/container-runtime/src/dataStoreContext.ts | Introduced ContextDeltaManagerProxy to shim readonly state for backward compatibility. |
Other test and API-report files | Updated to include the new readonly functionality and compatibility markers. |
Files not reviewed (2)
- packages/framework/aqueduct/package.json: Language not supported
- packages/runtime/datastore/package.json: Language not supported
Comments suppressed due to low confidence (1)
packages/runtime/runtime-definitions/src/runtimeLayerCompatFeatureNames.ts:18
- [nitpick] The naming for the readonly feature is inconsistent with other related methods (e.g. setReadOnlyState, get readonly) where 'ReadOnly' is camel-cased. Consider renaming the constant to 'setReadOnly' for consistency.
export const setReadonly = "setReadonly" as const;
Co-authored-by: Mark Fields <markfields@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Co-authored-by: Kian Thompson <102998837+kian-thompson@users.noreply.github.com>
Co-authored-by: Matt Rakow <ChumpChief@users.noreply.github.com>
…rphy/FluidFramework-1 into ro/datastore-readonly
…to ro/datastore-readonly
3f52a4f
to
0b0ccc3
Compare
0b0ccc3
to
c27695d
Compare
🔗 No broken links found! ✅ Your attention to detail is admirable. linkcheck output
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The plumbing across layers is a bit painful (i.e. taking different shapes, mechanisms, optionalities, etc.) but I don't think significantly moreso than for connection state. Not sure what the solution looks like, but I suppose if we manage to solve it for one we'll solve it for the other too.
This change plumbs through the readonly flag from the container runtime to the data store runtime. This will reduce reliance on the delta manager in datastores as one of the primary reasons it is used is to retrieve the readonly flag. In addition to the flag, this change also propagates the readonly event, so changes can be detected.
In order to be backward compatible, there is code in the DataStoreContext which ensures that the readonly flag is correctly set for older data stores. In the FluidDataStoreRuntime this is code to handle context's which do and don't support setting readonly. These together ensure a consistent experience for developers, regardless of the versions they are using.
The primary motivation for this change is to leverage readonly to deal with back and forward compat between layers, as we can build upon this to support putting specific datastore into readonly if they do not support some feature. I plan to leverage this for staging mode, so datastores which should not submit changes during staging mode, can be placed in readonly.
AB#32463